import router from '@/router';
const goods={
    state:{
        goodsList:[],
    },
    mutations:{
        ADD_Goods(state,{goodsName,goodsPrice}){
            if(state.goodsList.some(v=>v.goodsName===goodsName)){
                alert("商品名称不允许重复");
                return;
            }
            state.goodsList.unshift({

                goodsName,
                goodsPrice,
                addTime: Date.now(),
            });
            router.push('/goodslist');
        }
    }
}
export default goods;